#ifndef BEJ_TEST_H
#define BEJ_TEST_H


#include <iostream>
#include <stack>
using namespace std;

void BejSolve(int arr[8],int boolarr[8])
{
    stack<int> store;
    stack<int> temp;
    int count = 0;
    store.push(-1);
    for (int i = 0; i < 8; i++)
    {
        store.push(i);
    }
    int num = arr[store.top()];
    while(!store.empty())
    {
        if(arr[store.top()] == num && store.top()!= -1)
        {
            count++;
            temp.push(store.top());
            store.pop();
        }
        else
        {
            num = arr[store.top()];
            if(count < 3)
            {
                while(!temp.empty())
                {
                    temp.pop();
                    count--;
                }
            }
            else
            {
                while(!temp.empty())
                {
                    boolarr[temp.top()] = 0;
                    temp.pop();
                    count--;
                }
            }
            temp.push(store.top());
            store.pop();
            count++;
        }
    }
}

#endif // BEJ_TEST_H